package com.example.administrator.familfinalcialmanagement.ui.activity;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;

import com.example.administrator.familfinalcialmanagement.R;
import com.example.administrator.familfinalcialmanagement.databinding.ActivityReceiveTaskBinding;
import com.example.administrator.familfinalcialmanagement.ui.BaseActivity;
import com.example.administrator.familfinalcialmanagement.ui.adapter.IndexFirstAdapter;
import com.example.administrator.familfinalcialmanagement.util.listener.OnItemClickListener;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by SensYang on 2019/03/28 22:03
 */

public class ReceiveTaskActivity extends BaseActivity{

    ActivityReceiveTaskBinding binding;
    List<String> strs = new ArrayList<>();
    IndexFirstAdapter adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this,R.layout.activity_receive_task);
        binding.setActivity(this);
        initView();
    }

    private void initView() {
        setBack();
        setTitleText("接单");

        binding.refreshLayout.autoRefresh();
        binding.refreshLayout.finishRefresh();

        adapter = new IndexFirstAdapter(this,strs);
        binding.recycler.setLayoutManager(new LinearLayoutManager(this));
        binding.recycler.setAdapter(adapter);
        adapter.setOnItemClickLitener(new OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {
                startActivity(new Intent(ReceiveTaskActivity.this,TaskDescActivity.class));
            }

            @Override
            public void onItemLongClick(View view, int position) {

            }
        });
    }
}
